import { BrowserRouter as Router, Switch, Route, Redirect } from 'react-router-dom'

import Login from './pages/Login'
import Index from './pages/Index'
import Register from './pages/Register'
import Details from './pages/Details'

function App() {
  return (
    <Router>
      <Switch>
        <Route path="/login" component={Login} />
        <Route path="/index" component={Index} />
        <Route path="/register" component={Register} />
        {/* 根据路由接收传递过来的userId */}
        <Route path="/details/:id" component={Details} />
        <Redirect to="/login" />
      </Switch>
    </Router>
  );
}

export default App;
